﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        List<clsPoMain> list = null;
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Id");
            IEnumerable<DataRow> querys = dt.AsEnumerable();

        }

        private void button1_Click(object sender, EventArgs e)
        {

            lotusEntities lotus = new lotusEntities();
            IEnumerable<Persons> persons = lotus.Persons.AsEnumerable();
            persons.FirstOrDefault(p => p.Id == 1001);
            foreach(var v in persons)
            {
                v.City = "珠海123";

            }
            lotus.SaveChanges();

            Scores score = new Scores();
            score.personId = 1001;
            score.scoreId = 1;
            score.score = 90;

            lotus.Scores.Add(score);
            lotus.SaveChanges();
        }

        private void GetUserName(string p_userName)
        {

        }

        private string userName;
        private string _userName;
       
        public string UserName
        {



            get { return _userName; }

            set { value = _userName; }
        }
         
        private void button2_Click(object sender, EventArgs e)
        {

            //clsPersons  person=  ClsLotusDataContext.db.persons.FirstOrDefault(p => p.Id == 1001);
            //person.City = "珠海金湾区";
            ClsLotusDataContext.db.SubmitChanges();
            clsPoMain poMain = ClsLotusDataContext.db.poMains.FirstOrDefault(p => p.POID == 1000000001);
            poMain.cMemo = "test123";
            ClsLotusDataContext.db.SubmitChanges();
            clsPODetails poDetails = ClsLotusDataContext.db.poDetails.FirstOrDefault(p => p.ID == 1000000001);
            poDetails.cPOID = "123";
            ClsLotusDataContext.db.SubmitChanges();


        }
    }
}
